package com.by.aop;

/**
 * @version 1.0
 * @Author 彭彦彬
 * @Date 2025/4/8 20:25
 * @注释
 */
import java.lang.reflect.Method;

public class MethodInvocation {
    private Object target; // 目标对象
    private Method method; // 调用的方法
    private Object[] args; // 方法参数

    public MethodInvocation(Object target, Method method, Object[] args) {
        this.target = target;
        this.method = method;
        this.args = args;
    }

    public Object getTarget() {
        return target;
    }

    public Method getMethod() {
        return method;
    }

    public Object[] getArgs() {
        return args;
    }

    // 执行原始方法
    public Object proceed() throws Throwable {
        return method.invoke(target, args);
    }
}